package cn.wolfcode.transfer.domain;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.wolfcode.transfer.util.ConsumptionStatusUtil;
import cn.wolfcode.transfer.util.StatusUtil;
import com.alibaba.fastjson.JSON;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;

public class Appointment {
    /** 主键*/
    private Long id;

    /** 预约单流水号*/
    private String ano;

    /** 预约单状态 （预约中/履行中/消费中/归档/废弃单）*/
    private Integer status;

    /** 业务大类*/
    private SystemDictionaryItem category;

    /** 预约说明*/
    private String info;

    /** 联系电话*/
    private String contactTel;

    /** 联系人名称*/
    private String contactName;

    /** 预约门店*/
    private Business business;

    /** 创建时间*/
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 预约时间*/
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    private Date appointmentTime;


    public String toJson(){
        HashMap<String,Object> map =new HashMap();
        map.put("id",id);
        map.put("business",business.getId());
        map.put("appointmentTime", DateUtil.format(appointmentTime,"yyyy-MM-dd HH:mm"));
        map.put("category",category.getId());
        map.put("contactName",contactName);
        map.put("contactTel",contactTel);
        map.put("info",info);
        return JSON.toJSONString(map);
    }

public String toStatus(){
    StatusUtil[] values = StatusUtil.values();
    return values[this.status].toString();
}
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAno() {
        return ano;
    }

    public void setAno(String ano) {
        this.ano = ano;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public SystemDictionaryItem getCategory() {
        return category;
    }

    public void setCategory(SystemDictionaryItem category) {
        this.category = category;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getContactTel() {
        return contactTel;
    }

    public void setContactTel(String contactTel) {
        this.contactTel = contactTel;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public Business getBusiness() {
        return business;
    }

    public void setBusiness(Business business) {
        this.business = business;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getAppointmentTime() {
        return appointmentTime;
    }

    public void setAppointmentTime(Date appointmentTime) {
        this.appointmentTime = appointmentTime;
    }
}